<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>设备管理</title>
    <#include "../../common/link.ftl">
    <script>
        $(function () {
            // 查看申请理由
            $(".reasonBtn").click(function () {
                //数据复原
                $("#editForm").clearForm(true);

                var json = $(this).data('json');
                if(json){
                    $("textarea[name='reason']").val(json.reason);
                }
                $("#inputSynModal").modal('show');
            });

            // 查看失败理由
            $(".returnRefuseBtn").click(function () {
                //数据复原
                $("#editForm2").clearForm(true);
                var json = $(this).data('json');
                if(json){
                    $("textarea[name='returnRefuse']").val(json.returnRefuse);
                }
                $("#inputSynModal2").modal('show');
            });
        })
    </script>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <#include "../../common/navbar.ftl">
    <!--菜单回显-->
    <#assign currentMenu="returnListAdmin"/>
    <#include "../../common/menu.ftl">
    <div class="content-wrapper">
        <section class="content-header">
            <h1>设备借还记录</h1>
        </section>
        <section class="content">
            <div class="box">
                <!--高级查询--->
                <div style="margin: 10px;">
                    <form class="form-inline" id="searchForm" action="/deviceRecord/admin/returnList.do" method="post">
                        <input type="hidden" name="currentPage" id="currentPage" value="1">
                        <div class="form-group">
                            <label for="keyword">关键字：</label>
                            <input type="text" class="form-control" id="keyword" name="keyword" value="${qo.keyword!}" placeholder="请输入设备/社团/负责人">
                        </div>
                        &nbsp;
                        <div class="form-group">
                            <label for="returnStatus"> 归还：</label>
                            <select class="form-control" id="returnStatus" name="returnStatus">
                                <option value="-1">全部</option>
                                <option value="0">申请中</option>
                                <option value="1">归还成功</option>
                                <option value="2">归还失败</option>
                            </select>
                            <script>
                                $("#returnStatus").val(${qo.returnStatus!});
                            </script>
                        </div>
                        &nbsp;
                        <button id="btn_query" class="btn btn-primary"><span class="glyphicon glyphicon-search"></span> 查询</button>
                    </form>
                </div>
                <table class="table table-hover table-bordered">
                    <thead>
                    <tr>
                        <th>编号</th>
                        <th>图片</th>
                        <th>设备名称</th>
                        <th>归还数量</th>
                        <th>社团名称</th>
                        <th>归还时间</th>
                        <th>负责人</th>
                        <th>联系方式</th>
                        <th>申请理由</th>
                        <th>状态</th>
                        <th>归还失败理由</th>
                    </tr>
                    </thead>
                    <#list page.list as deviceRecord>
                        <tr>
                            <td>${deviceRecord_index+1}</td>
                            <td><img src="${(deviceRecord.imgUrl)!'/images/default.jpg'}" width="50px" id="imgUrl"></td>
                            <td>${deviceRecord.deviceName!}</td>
                            <td>${deviceRecord.number!}</td>
                            <td>${deviceRecord.association!}</td>
                            <td>${(deviceRecord.returnTime?string('yyyy-MM-dd'))!}</td>
                            <td>${(deviceRecord.dutyName)!}</td>
                            <td>${(deviceRecord.mobile)!}</td>
                            <td>
                                <a class="reasonBtn" href="JavaScript:;" data-json='${deviceRecord.jsonString!}'>申请理由</a>
                            </td>
                            <td>
                                <#if (deviceRecord.isReturn!) == 0>
                                    申请中
                                </#if>
                                <#if (deviceRecord.isReturn!) == 1>
                                    成功
                                </#if>
                                <#if (deviceRecord.isReturn!) == 2>
                                    失败
                                </#if>
                            </td>
                            <td>
                                <#if (deviceRecord.isReturn!) == 2>
                                    <a class="returnRefuseBtn" href="JavaScript:;" data-json='${deviceRecord.jsonString!}'>失败理由</a>
                                </#if>
                            </td>
                        </tr>
                    </#list>
                </table>
                <!--分页-->
                <#include "../../common/page.ftl">
            </div>
        </section>
    </div>
    <#include "../../common/footer.ftl">
</div>

<!-- 大图显示 -->
<div id="ShowImage_Form" class="modal fade" >
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body" >
            </div>
        </div>
    </div>
</div>

<script>
    $("table img").click(function(){
        var src = $(this).attr("src");
        $("#ShowImage_Form .modal-body").html("<img src='"+src+"' class='carousel-inner img-responsive img-rounded' />");
        $("#ShowImage_Form").modal('show');
    })
</script>

<!-- Modal模态框 -->
<div class="modal fade" id="inputSynModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalSynLabel">申请理由</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" action="" method="post" id="editForm">
                    <div class="form-group">
                        <div class="col-sm-12">
                            <textarea rows="10" style="min-width: 100%" name="reason"></textarea>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<!-- Modal模态框 -->
<div class="modal fade" id="inputSynModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title2" id="myModalSynLabel2">归还失败理由</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" action="" method="post" id="editForm2">
                    <div class="form-group">
                        <div class="col-sm-12">
                            <textarea rows="10" style="min-width: 100%" name="agreeRefuse"></textarea>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
</body>
</html>
